import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '区域类型',
    align: "center",
    dataIndex: 'regionType_dictText'
  },
  {
    title: '危险化学品名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: 'CAS号',
    align: "center",
    dataIndex: 'casNumber'
  },
  {
    title: '化学品类型',
    align: "center",
    dataIndex: 'chemicalClass_dictText'
  },
  {
    title: '作用',
    align: "center",
    dataIndex: 'effect'
  },
  {
    title: '最大储存量（t）',
    align: "center",
    dataIndex: 'maxStorage'
  },
  {
    title: '实时储存量',
    align: "center",
    dataIndex: 'realTimeStorage'
  },
  {
    title: '储存方式/地点',
    align: "center",
    dataIndex: 'storageMethodLocation'
  },
  {
    title: '产品生产能力（吨）',
    align: "center",
    dataIndex: 'productiveCapacity'
  },
  {
    title: '产品生产能力气体（方）',
    align: "center",
    dataIndex: 'maxProductiveGas'
  },
  {
    title: '产品最大储量（吨）',
    align: "center",
    dataIndex: 'maxReservesTonsOf'
  },
  {
    title: '产品最大储量气体（方）',
    align: "center",
    dataIndex: 'maxReservesCube'
  },
  {
    title: '是否重点监管化学品',
    align: "center",
    dataIndex: 'isKeyChemicals_dictText'
  },
  {
    title: '是否易制爆',
    align: "center",
    dataIndex: 'isInhibitingExplosion_dictText'
  },
  {
    title: '是否剧毒',
    align: "center",
    dataIndex: 'isHighlyToxic_dictText'
  },
  {
    title: '是否易制毒',
    align: "center",
    dataIndex: 'isManufactureDrugs_dictText'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '上传文件',
    align: "center",
    dataIndex: 'doc',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "区域类型",
    field: 'regionType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "regionType"
    },
    //colProps: {span: 6},
  },
  {
    label: "危险化学品名称",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "CAS号",
    field: 'casNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "化学品类型",
    field: 'chemicalClass',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "chemicalClass"
    },
    //colProps: {span: 6},
  },
  {
    label: "是否易制爆",
    field: 'isInhibitingExplosion',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
  {
    label: "是否剧毒",
    field: 'isHighlyToxic',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
  {
    label: "是否易制毒",
    field: 'isManufactureDrugs',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '区域类型',
    field: 'regionType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "regionType"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入区域类型!'},
             ];
    },
  },
  {
    label: '危险化学品名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入危险化学品名称!'},
             ];
    },
  },
  {
    label: 'CAS号',
    field: 'casNumber',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入CAS号!'},
             ];
    },
  },
  {
    label: '化学品类型',
    field: 'chemicalClass',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "chemicalClass"
    },
  },
  {
    label: '作用',
    field: 'effect',
    component: 'Input',
  },
  {
    label: '最大储存量（t）',
    field: 'maxStorage',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入最大储存量（t）!'},
             ];
    },
  },
  {
    label: '实时储存量',
    field: 'realTimeStorage',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入实时储存量!'},
             ];
    },
  },
  {
    label: '储存方式/地点',
    field: 'storageMethodLocation',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入储存方式/地点!'},
             ];
    },
  },
  {
    label: '产品生产能力（吨）',
    field: 'productiveCapacity',
    component: 'InputNumber',
  },
  {
    label: '产品生产能力气体（方）',
    field: 'maxProductiveGas',
    component: 'InputNumber',
  },
  {
    label: '产品最大储量（吨）',
    field: 'maxReservesTonsOf',
    component: 'InputNumber',
  },
  {
    label: '产品最大储量气体（方）',
    field: 'maxReservesCube',
    component: 'InputNumber',
  },
  {
    label: '是否重点监管化学品',
    field: 'isKeyChemicals',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '是否易制爆',
    field: 'isInhibitingExplosion',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '是否剧毒',
    field: 'isHighlyToxic',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '是否易制毒',
    field: 'isManufactureDrugs',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "normalOrStop"
    },
  },
  {
    label: '上传文件',
    field: 'doc',
    component: 'JUpload',
    componentProps:{
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  regionType: {title: '区域类型',order: 0,view: 'list', type: 'string',dictCode: 'regionType',},
  name: {title: '危险化学品名称',order: 1,view: 'text', type: 'string',},
  casNumber: {title: 'CAS号',order: 2,view: 'text', type: 'string',},
  chemicalClass: {title: '化学品类型',order: 3,view: 'list', type: 'string',dictCode: 'chemicalClass',},
  effect: {title: '作用',order: 4,view: 'text', type: 'string',},
  maxStorage: {title: '最大储存量（t）',order: 5,view: 'number', type: 'number',},
  realTimeStorage: {title: '实时储存量',order: 6,view: 'number', type: 'number',},
  storageMethodLocation: {title: '储存方式/地点',order: 7,view: 'text', type: 'string',},
  productiveCapacity: {title: '产品生产能力（吨）',order: 8,view: 'number', type: 'number',},
  maxProductiveGas: {title: '产品生产能力气体（方）',order: 9,view: 'number', type: 'number',},
  maxReservesTonsOf: {title: '产品最大储量（吨）',order: 10,view: 'number', type: 'number',},
  maxReservesCube: {title: '产品最大储量气体（方）',order: 11,view: 'number', type: 'number',},
  isKeyChemicals: {title: '是否重点监管化学品',order: 12,view: 'radio', type: 'string',},
  isInhibitingExplosion: {title: '是否易制爆',order: 13,view: 'radio', type: 'string',},
  isHighlyToxic: {title: '是否剧毒',order: 14,view: 'radio', type: 'string',},
  isManufactureDrugs: {title: '是否易制毒',order: 15,view: 'radio', type: 'string',},
  status: {title: '状态',order: 16,view: 'text', type: 'string',},
  doc: {title: '上传文件',order: 17,view: 'file', type: 'string',},
};
